package com.ele.web;

import com.ele.pojo.PageResult;
import com.ele.pojo.Shop;
import com.ele.service.ShopService;
import com.ele.service.impl.ShopServiceImpl;
import com.google.gson.Gson;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/shopAuditList")
public class ShopAuditListServlet extends HttpServlet {
    private ShopService shopService = new ShopServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String currentPage = req.getParameter("currentPage");
        String pageSize = req.getParameter("pageSize");
        String shopName = req.getParameter("shopName");
        String status = req.getParameter("status");

        PageResult<List<Shop>> result = this.shopService.shopAuditList(currentPage, pageSize, shopName, status);
        String json = new Gson().toJson(result);
        resp.setContentType("application/json;charset=utf-8");
        resp.getWriter().write(json);
    }
}
